home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / namcos86.c < prev    next >
C/C++ Source or Header  |  2000-04-23  |  67KB  |  1,754 lines

  1. /*******************************************************************
  2. Rolling Thunder
  3. (C) 1986 Namco
  4.  
  5. To Do:
  6. -----
  7. Remove sprite lag (watch the "bullets" signs on the walls during scrolling).
  8.   Increasing vblank_duration does it but some sprites flicker.
  9.  
  10. Add correct dipswitches and potentially fix controls in Wonder Momo.
  11.  
  12. Notes:
  13. -----
  14. PCM roms sample tables:
  15. At the beggining of each PCM sound ROM you can find a 2 byte
  16. offset to the beggining of each sample in the rom. Since the
  17. table is not in sequential order, it is possible that the order
  18. of the table is actually the sound number. Each sample ends in
  19. a 0xff mark.
  20.  
  21. *******************************************************************/
  22.  
  23. #include "driver.h"
  24. #include "cpu/m6809/m6809.h"
  25. #include "cpu/m6800/m6800.h"
  26.  
  27. extern unsigned char *rthunder_videoram1, *rthunder_videoram2, *spriteram, *dirtybuffer;
  28.  
  29. /*******************************************************************/
  30.  
  31. void namcos86_vh_convert_color_prom(unsigned char *palette,unsigned short *colortable,const unsigned char *color_prom);
  32. int namcos86_vh_start(void);
  33. void namcos86_vh_screenrefresh(struct osd_bitmap *bitmap,int fullrefresh);
  34. READ_HANDLER( rthunder_videoram1_r );
  35. WRITE_HANDLER( rthunder_videoram1_w );
  36. READ_HANDLER( rthunder_videoram2_r );
  37. WRITE_HANDLER( rthunder_videoram2_w );
  38. WRITE_HANDLER( rthunder_scroll0_w );
  39. WRITE_HANDLER( rthunder_scroll1_w );
  40. WRITE_HANDLER( rthunder_scroll2_w );
  41. WRITE_HANDLER( rthunder_scroll3_w );
  42. WRITE_HANDLER( rthunder_backcolor_w );
  43. WRITE_HANDLER( rthunder_tilebank_select_0_w );
  44. WRITE_HANDLER( rthunder_tilebank_select_1_w );
  45.  
  46.  
  47.  
  48. /*******************************************************************/
  49.  
  50. /* Sampled voices (Modified and Added by Takahiro Nogi. 1999/09/26) */
  51.  
  52. /* signed/unsigned 8-bit conversion macros */
  53. #define AUDIO_CONV(A) ((A)^0x80)
  54.  
  55. static int rt_totalsamples[6];
  56. static int rt_decode_mode;
  57.  
  58.  
  59. static int rt_decode_sample(const struct MachineSound *msound)
  60. {
  61.     struct GameSamples *samples;
  62.     unsigned char *src, *scan, *dest, last=0;
  63.     int size, n = 0, j;
  64.     int decode_mode;
  65.  
  66.     j = memory_region_length(REGION_SOUND1);
  67.     if (j == 0) return 0;    /* no samples in this game */
  68.     else if (j == 0x80000)    /* genpeitd */
  69.         rt_decode_mode = 1;
  70.     else
  71.         rt_decode_mode = 0;
  72.  
  73.     logerror("pcm decode mode:%d\n", rt_decode_mode );
  74.     if (rt_decode_mode != 0) {
  75.         decode_mode = 6;
  76.     } else {
  77.         decode_mode = 4;
  78.     }
  79.  
  80.     /* get amount of samples */
  81.     for ( j = 0; j < decode_mode; j++ ) {
  82.         src = memory_region(REGION_SOUND1)+ ( j * 0x10000 );
  83.         rt_totalsamples[j] = ( ( src[0] << 8 ) + src[1] ) / 2;
  84.         n += rt_totalsamples[j];
  85.         logerror("rt_totalsamples[%d]:%d\n", j, rt_totalsamples[j] );
  86.     }
  87.  
  88.     /* calculate the amount of headers needed */
  89.     size = sizeof( struct GameSamples ) + n * sizeof( struct GameSamples * );
  90.  
  91.     /* allocate */
  92.     if ( ( Machine->samples = malloc( size ) ) == NULL )
  93.         return 1;
  94.  
  95.     samples = Machine->samples;
  96.     samples->total = n;
  97.  
  98.     for ( n = 0; n < samples->total; n++ ) {
  99.         int indx, start, offs;
  100.  
  101.         if ( n < rt_totalsamples[0] ) {
  102.             src = memory_region(REGION_SOUND1);
  103.             indx = n;
  104.         } else
  105.             if ( ( n - rt_totalsamples[0] ) < rt_totalsamples[1] ) {
  106.                 src = memory_region(REGION_SOUND1)+0x10000;
  107.                 indx = n - rt_totalsamples[0];
  108.             } else
  109.                 if ( ( n - ( rt_totalsamples[0] + rt_totalsamples[1] ) ) < rt_totalsamples[2] ) {
  110.                     src = memory_region(REGION_SOUND1)+0x20000;
  111.                     indx = n - ( rt_totalsamples[0] + rt_totalsamples[1] );
  112.                 } else
  113.                     if ( ( n - ( rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2] ) ) < rt_totalsamples[3] ) {
  114.                         src = memory_region(REGION_SOUND1)+0x30000;
  115.                         indx = n - ( rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2] );
  116.                     } else
  117.                         if ( ( n - ( rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2] + rt_totalsamples[3] ) ) < rt_totalsamples[4] ) {
  118.                             src = memory_region(REGION_SOUND1)+0x40000;
  119.                             indx = n - ( rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2] + rt_totalsamples[3] );
  120.                         } else
  121.                             if ( ( n - ( rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2] + rt_totalsamples[3] + rt_totalsamples[4] ) ) < rt_totalsamples[5] ) {
  122.                                 src = memory_region(REGION_SOUND1)+0x50000;
  123.                                 indx = n - ( rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2] + rt_totalsamples[3] + rt_totalsamples[4] );
  124.                             } else {
  125.                                 src = memory_region(REGION_SOUND1)+0x60000;
  126.                                 indx = n - ( rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2] + rt_totalsamples[3] + rt_totalsamples[4] + rt_totalsamples[5] );
  127.                             }
  128.  
  129.         /* calculate header offset */
  130.         offs = indx * 2;
  131.  
  132.         /* get sample start offset */
  133.         start = ( src[offs] << 8 ) + src[offs+1];
  134.  
  135.         /* calculate the sample size */
  136.         scan = &src[start];
  137.         size = 0;
  138.  
  139.         while ( *scan != 0xff ) {
  140.             if ( *scan == 0x00 ) { /* run length encoded data start tag */
  141.                 /* get RLE size */
  142.                 size += scan[1] + 1;
  143.                 scan += 2;
  144.             } else {
  145.                 size++;
  146.                 scan++;
  147.             }
  148.         }
  149.  
  150.         /* allocate sample */
  151.         if ( ( samples->sample[n] = malloc( sizeof( struct GameSample ) + size * sizeof( unsigned char ) ) ) == NULL )
  152.             return 1;
  153.  
  154.         /* fill up the sample info */
  155.         samples->sample[n]->length = size;
  156.         samples->sample[n]->smpfreq = 6000;    /* 6 kHz */
  157.         samples->sample[n]->resolution = 8;    /* 8 bit */
  158.  
  159.         /* unpack sample */
  160.         dest = (unsigned char *)samples->sample[n]->data;
  161.         scan = &src[start];
  162.  
  163.         while ( *scan != 0xff ) {
  164.             if ( *scan == 0x00 ) { /* run length encoded data start tag */
  165.                 int i;
  166.                 for ( i = 0; i <= scan[1]; i++ ) /* unpack RLE */
  167.                     *dest++ = last;
  168.  
  169.                 scan += 2;
  170.             } else {
  171.                 last = AUDIO_CONV( scan[0] );
  172.                 *dest++ = last;
  173.                 scan++;
  174.             }
  175.         }
  176.     }
  177.  
  178.     return 0; /* no errors */
  179. }
  180.  
  181.  
  182. /* play voice sample (Modified and Added by Takahiro Nogi. 1999/09/26) */
  183. static int voice[2];
  184.  
  185. static void namco_voice_play( int offset, int data, int ch ) {
  186.  
  187.     if ( voice[ch] == -1 )
  188.         sample_stop( ch );
  189.     else
  190.         sample_start( ch, voice[ch], 0 );
  191. }
  192.  
  193. static WRITE_HANDLER( namco_voice0_play_w ) {
  194.  
  195.     namco_voice_play(offset, data, 0);
  196. }
  197.  
  198. static WRITE_HANDLER( namco_voice1_play_w ) {
  199.  
  200.     namco_voice_play(offset, data, 1);
  201. }
  202.  
  203. /* select voice sample (Modified and Added by Takahiro Nogi. 1999/09/26) */
  204. static void namco_voice_select( int offset, int data, int ch ) {
  205.  
  206.     logerror("Voice %d mode: %d select: %02x\n", ch, rt_decode_mode, data );
  207.  
  208.     if ( data == 0 )
  209.         sample_stop( ch );
  210.  
  211.     if (rt_decode_mode != 0) {
  212.         switch ( data & 0xe0 ) {
  213.             case 0x00:
  214.             break;
  215.  
  216.             case 0x20:
  217.                 data &= 0x1f;
  218.                 data += rt_totalsamples[0];
  219.             break;
  220.  
  221.             case 0x40:
  222.                 data &= 0x1f;
  223.                 data += rt_totalsamples[0] + rt_totalsamples[1];
  224.             break;
  225.  
  226.             case 0x60:
  227.                 data &= 0x1f;
  228.                 data += rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2];
  229.             break;
  230.  
  231.             case 0x80:
  232.                 data &= 0x1f;
  233.                 data += rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2] + rt_totalsamples[3];
  234.             break;
  235.  
  236.             case 0xa0:
  237.                 data &= 0x1f;
  238.                 data += rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2] + rt_totalsamples[3] + rt_totalsamples[4];
  239.             break;
  240.  
  241.             case 0xc0:
  242.                 data &= 0x1f;
  243.                 data += rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2] + rt_totalsamples[3] + rt_totalsamples[4] + rt_totalsamples[5];
  244.             break;
  245.  
  246.             case 0xe0:
  247.                 data &= 0x1f;
  248.                 data += rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2] + rt_totalsamples[3] + rt_totalsamples[4] + rt_totalsamples[5] + rt_totalsamples[6];
  249.             break;
  250.         }
  251.     } else {
  252.         switch ( data & 0xc0 ) {
  253.             case 0x00:
  254.             break;
  255.  
  256.             case 0x40:
  257.                 data &= 0x3f;
  258.                 data += rt_totalsamples[0];
  259.             break;
  260.  
  261.             case 0x80:
  262.                 data &= 0x3f;
  263.                 data += rt_totalsamples[0] + rt_totalsamples[1];
  264.             break;
  265.  
  266.             case 0xc0:
  267.                 data &= 0x3f;
  268.                 data += rt_totalsamples[0] + rt_totalsamples[1] + rt_totalsamples[2];
  269.             break;
  270.         }
  271.     }
  272.  
  273.     voice[ch] = data - 1;
  274. }
  275.  
  276. static WRITE_HANDLER( namco_voice0_select_w ) {
  277.  
  278.     namco_voice_select(offset, data, 0);
  279. }
  280.  
  281. static WRITE_HANDLER( namco_voice1_select_w ) {
  282.  
  283.     namco_voice_select(offset, data, 1);
  284. }
  285. /*******************************************************************/
  286.  
  287. /* shared memory area with the mcu */
  288. static unsigned char *shared1;
  289. static READ_HANDLER( shared1_r ) { return shared1[offset]; }
  290. static WRITE_HANDLER( shared1_w ) { shared1[offset] = data; }
  291.  
  292.  
  293.  
  294. static WRITE_HANDLER( spriteram_w )
  295. {
  296.     spriteram[offset] = data;
  297. }
  298. static READ_HANDLER( spriteram_r )
  299. {
  300.     return spriteram[offset];
  301. }
  302.  
  303. static WRITE_HANDLER( bankswitch1_w )
  304. {
  305.     unsigned char *base = memory_region(REGION_CPU1) + 0x10000;
  306.  
  307.     /* if the ROM expansion module is available, don't do anything. This avoids conflict */
  308.     /* with bankswitch1_ext_w() in wndrmomo */
  309.     if (memory_region(REGION_USER1)) return;
  310.  
  311.     cpu_setbank(1,base + ((data & 0x03) * 0x2000));
  312. }
  313.  
  314. static WRITE_HANDLER( bankswitch1_ext_w )
  315. {
  316.     unsigned char *base = memory_region(REGION_USER1);
  317.  
  318.     if (base == 0) return;
  319.  
  320.     cpu_setbank(1,base + ((data & 0x1f) * 0x2000));
  321. }
  322.  
  323. static WRITE_HANDLER( bankswitch2_w )
  324. {
  325.     unsigned char *base = memory_region(REGION_CPU2) + 0x10000;
  326.  
  327.     cpu_setbank(2,base + ((data & 0x03) * 0x2000));
  328. }
  329.  
  330. /* Stubs to pass the correct Dip Switch setup to the MCU */
  331. static READ_HANDLER( dsw0_r )
  332. {
  333.     int rhi, rlo;
  334.  
  335.     rhi = ( readinputport( 2 ) & 0x01 ) << 4;
  336.     rhi |= ( readinputport( 2 ) & 0x04 ) << 3;
  337.     rhi |= ( readinputport( 2 ) & 0x10 ) << 2;
  338.     rhi |= ( readinputport( 2 ) & 0x40 ) << 1;
  339.  
  340.     rlo = ( readinputport( 3 ) & 0x01 );
  341.     rlo |= ( readinputport( 3 ) & 0x04 ) >> 1;
  342.     rlo |= ( readinputport( 3 ) & 0x10 ) >> 2;
  343.     rlo |= ( readinputport( 3 ) & 0x40 ) >> 3;
  344.  
  345.     return ~( rhi | rlo ) & 0xff; /* Active Low */
  346. }
  347.  
  348. static READ_HANDLER( dsw1_r )
  349. {
  350.     int rhi, rlo;
  351.  
  352.     rhi = ( readinputport( 2 ) & 0x02 ) << 3;
  353.     rhi |= ( readinputport( 2 ) & 0x08 ) << 2;
  354.     rhi |= ( readinputport( 2 ) & 0x20 ) << 1;
  355.     rhi |= ( readinputport( 2 ) & 0x80 );
  356.  
  357.     rlo = ( readinputport( 3 ) & 0x02 ) >> 1;
  358.     rlo |= ( readinputport( 3 ) & 0x08 ) >> 2;
  359.     rlo |= ( readinputport( 3 ) & 0x20 ) >> 3;
  360.     rlo |= ( readinputport( 3 ) & 0x80 ) >> 4;
  361.  
  362.     return ~( rhi | rlo ) & 0xff; /* Active Low */
  363. }
  364.  
  365. static int int_enabled[2];
  366.  
  367. static WRITE_HANDLER( int_ack1_w )
  368. {
  369.     int_enabled[0] = 1;
  370. }
  371.  
  372. static WRITE_HANDLER( int_ack2_w )
  373. {
  374.     int_enabled[1] = 1;
  375. }
  376.  
  377. static int namco86_interrupt1(void)
  378. {
  379.     if (int_enabled[0])
  380.     {
  381.         int_enabled[0] = 0;
  382.         return interrupt();
  383.     }
  384.  
  385.     return ignore_interrupt();
  386. }
  387.  
  388. static int namco86_interrupt2(void)
  389. {
  390.     if (int_enabled[1])
  391.     {
  392.         int_enabled[1] = 0;
  393.         return interrupt();
  394.     }
  395.  
  396.     return ignore_interrupt();
  397. }
  398.  
  399. static WRITE_HANDLER( namcos86_coin_w )
  400. {
  401.     coin_lockout_global_w(0,data & 1);
  402.     coin_counter_w(0,~data & 2);
  403.     coin_counter_w(1,~data & 4);
  404. }
  405.  
  406. static WRITE_HANDLER( namcos86_led_w )
  407. {
  408.     osd_led_w(0,data >> 3);
  409.     osd_led_w(1,data >> 4);
  410. }
  411.  
  412.  
  413. /*******************************************************************/
  414.  
  415. static struct MemoryReadAddress readmem1[] =
  416. {
  417.     { 0x0000, 0x1fff, rthunder_videoram1_r },
  418.     { 0x2000, 0x3fff, rthunder_videoram2_r },
  419.     { 0x4000, 0x40ff, namcos1_wavedata_r }, /* PSG device, shared RAM */
  420.     { 0x4100, 0x413f, namcos1_sound_r }, /* PSG device, shared RAM */
  421.     { 0x4000, 0x43ff, shared1_r },
  422.     { 0x4400, 0x5fff, spriteram_r },
  423.     { 0x6000, 0x7fff, MRA_BANK1 },
  424.     { 0x8000, 0xffff, MRA_ROM },
  425.     { -1 }
  426. };
  427.  
  428. static struct MemoryWriteAddress writemem1[] =
  429. {
  430.     { 0x0000, 0x1fff, rthunder_videoram1_w, &rthunder_videoram1 },
  431.     { 0x2000, 0x3fff, rthunder_videoram2_w, &rthunder_videoram2 },
  432.  
  433.     { 0x4000, 0x40ff, namcos1_wavedata_w, &namco_wavedata }, /* PSG device, shared RAM */
  434.     { 0x4100, 0x413f, namcos1_sound_w, &namco_soundregs }, /* PSG device, shared RAM */
  435.     { 0x4000, 0x43ff, shared1_w, &shared1 },
  436.  
  437.     { 0x4400, 0x5fff, spriteram_w, &spriteram },
  438.  
  439.     { 0x6000, 0x6000, namco_voice0_play_w },
  440.     { 0x6200, 0x6200, namco_voice0_select_w },
  441.     { 0x6400, 0x6400, namco_voice1_play_w },
  442.     { 0x6600, 0x6600, namco_voice1_select_w },
  443.     { 0x6800, 0x6800, bankswitch1_ext_w },
  444. //    { 0x6c00, 0x6c00, MWA_NOP }, /* ??? */
  445. //    { 0x6e00, 0x6e00, MWA_NOP }, /* ??? */
  446.  
  447.     { 0x8000, 0x8000, watchdog_reset_w },
  448.     { 0x8400, 0x8400, int_ack1_w }, /* IRQ acknowledge */
  449.     { 0x8800, 0x8800, rthunder_tilebank_select_0_w },
  450.     { 0x8c00, 0x8c00, rthunder_tilebank_select_1_w },
  451.  
  452.     { 0x9000, 0x9002, rthunder_scroll0_w },    /* scroll + priority */
  453.     { 0x9003, 0x9003, bankswitch1_w },
  454.     { 0x9004, 0x9006, rthunder_scroll1_w },    /* scroll + priority */
  455.  
  456.     { 0x9400, 0x9402, rthunder_scroll2_w },    /* scroll + priority */
  457. //    { 0x9403, 0x9403 } sub CPU rom bank select would be here
  458.     { 0x9404, 0x9406, rthunder_scroll3_w },    /* scroll + priority */
  459.  
  460.     { 0xa000, 0xa000, rthunder_backcolor_w },
  461.  
  462.     { 0x8000, 0xffff, MWA_ROM },
  463.     { -1 }
  464. };
  465.  
  466.  
  467. #define CPU2_MEMORY(NAME,ADDR_SPRITE,ADDR_VIDEO1,ADDR_VIDEO2,ADDR_ROM,ADDR_BANK,ADDR_WDOG,ADDR_INT)    \
  468. static struct MemoryReadAddress NAME##_readmem2[] =                                    \
  469. {                                                                                    \
  470.     { ADDR_SPRITE+0x0000, ADDR_SPRITE+0x03ff, MRA_RAM },                            \
  471.     { ADDR_SPRITE+0x0400, ADDR_SPRITE+0x1fff, spriteram_r },                        \
  472.     { ADDR_VIDEO1+0x0000, ADDR_VIDEO1+0x1fff, rthunder_videoram1_r },                \
  473.     { ADDR_VIDEO2+0x0000, ADDR_VIDEO2+0x1fff, rthunder_videoram2_r },                \
  474.     { ADDR_ROM+0x0000, ADDR_ROM+0x1fff, MRA_BANK2 },                                \
  475.     { 0x8000, 0xffff, MRA_ROM },                                                    \
  476.     { -1 }                                                                            \
  477. };                                                                                    \
  478. static struct MemoryWriteAddress NAME##_writemem2[] =                                \
  479. {                                                                                    \
  480.     { ADDR_SPRITE+0x0000, ADDR_SPRITE+0x03ff, MWA_RAM },                            \
  481.     { ADDR_SPRITE+0x0400, ADDR_SPRITE+0x1fff, spriteram_w },                        \
  482.     { ADDR_VIDEO1+0x0000, ADDR_VIDEO1+0x1fff, rthunder_videoram1_w },                \
  483.     { ADDR_VIDEO2+0x0000, ADDR_VIDEO2+0x1fff, rthunder_videoram2_w },                \
  484. /*    { ADDR_BANK+0x00, ADDR_BANK+0x02 } layer 2 scroll registers would be here */    \
  485.     { ADDR_BANK+0x03, ADDR_BANK+0x03, bankswitch2_w },                                \
  486. /*    { ADDR_BANK+0x04, ADDR_BANK+0x06 } layer 3 scroll registers would be here */    \
  487.     { ADDR_WDOG, ADDR_WDOG, watchdog_reset_w },                                        \
  488.     { ADDR_INT, ADDR_INT, int_ack2_w },    /* IRQ acknowledge */                        \
  489.     { ADDR_ROM+0x0000, ADDR_ROM+0x1fff, MWA_ROM },                                    \
  490.     { 0x8000, 0xffff, MWA_ROM },                                                    \
  491.     { -1 }                                                                            \
  492. };
  493.  
  494. #define UNUSED 0x4000
  495. /*                     SPRITE  VIDEO1  VIDEO2  ROM     BANK    WDOG    IRQACK */
  496. CPU2_MEMORY( hopmappy, UNUSED, UNUSED, UNUSED, UNUSED, UNUSED, 0x9000, UNUSED )
  497. CPU2_MEMORY( skykiddx, UNUSED, UNUSED, UNUSED, UNUSED, UNUSED, 0x9000, 0x9400 )
  498. CPU2_MEMORY( roishtar, 0x0000, 0x6000, 0x4000, UNUSED, UNUSED, 0xa000, 0xb000 )
  499. CPU2_MEMORY( genpeitd, 0x4000, 0x0000, 0x2000, UNUSED, UNUSED, 0xb000, 0x8800 )
  500. CPU2_MEMORY( rthunder, 0x0000, 0x2000, 0x4000, 0x6000, 0xd800, 0x8000, 0x8800 )
  501. CPU2_MEMORY( wndrmomo, 0x2000, 0x4000, 0x6000, UNUSED, UNUSED, 0xc000, 0xc800 )
  502. #undef UNUSED
  503.  
  504.  
  505. #define MCU_MEMORY(NAME,ADDR_LOWROM,ADDR_INPUT,ADDR_UNK1,ADDR_UNK2)            \
  506. static struct MemoryReadAddress NAME##_mcu_readmem[] =                        \
  507. {                                                                            \
  508.     { 0x0000, 0x001f, hd63701_internal_registers_r },                        \
  509.     { 0x0080, 0x00ff, MRA_RAM },                                            \
  510.     { 0x1000, 0x10ff, namcos1_wavedata_r }, /* PSG device, shared RAM */    \
  511.     { 0x1100, 0x113f, namcos1_sound_r }, /* PSG device, shared RAM */        \
  512.     { 0x1000, 0x13ff, shared1_r },                                            \
  513.     { 0x1400, 0x1fff, MRA_RAM },                                            \
  514.     { ADDR_INPUT+0x00, ADDR_INPUT+0x01, YM2151_status_port_0_r },            \
  515.     { ADDR_INPUT+0x20, ADDR_INPUT+0x20, input_port_0_r },                    \
  516.     { ADDR_INPUT+0x21, ADDR_INPUT+0x21, input_port_1_r },                    \
  517.     { ADDR_INPUT+0x30, ADDR_INPUT+0x30, dsw0_r },                            \
  518.     { ADDR_INPUT+0x31, ADDR_INPUT+0x31, dsw1_r },                            \
  519.     { ADDR_LOWROM, ADDR_LOWROM+0x3fff, MRA_ROM },                            \
  520.     { 0x8000, 0xbfff, MRA_ROM },                                            \
  521.     { 0xf000, 0xffff, MRA_ROM },                                            \
  522.     { -1 } /* end of table */                                                \
  523. };                                                                            \
  524. static struct MemoryWriteAddress NAME##_mcu_writemem[] =                    \
  525. {                                                                            \
  526.     { 0x0000, 0x001f, hd63701_internal_registers_w },                        \
  527.     { 0x0080, 0x00ff, MWA_RAM },                                            \
  528.     { 0x1000, 0x10ff, namcos1_wavedata_w }, /* PSG device, shared RAM */    \
  529.     { 0x1100, 0x113f, namcos1_sound_w }, /* PSG device, shared RAM */        \
  530.     { 0x1000, 0x13ff, shared1_w },                                            \
  531.     { 0x1400, 0x1fff, MWA_RAM },                                            \
  532.     { ADDR_INPUT+0x00, ADDR_INPUT+0x00, YM2151_register_port_0_w },            \
  533.     { ADDR_INPUT+0x01, ADDR_INPUT+0x01, YM2151_data_port_0_w },                \
  534.     { ADDR_UNK1, ADDR_UNK1, MWA_NOP }, /* ??? written (not always) at end of interrupt */    \
  535.     { ADDR_UNK2, ADDR_UNK2, MWA_NOP }, /* ??? written (not always) at end of interrupt */    \
  536.     { ADDR_LOWROM, ADDR_LOWROM+0x3fff, MWA_ROM },                            \
  537.     { 0x8000, 0xbfff, MWA_ROM },                                            \
  538.     { 0xf000, 0xffff, MWA_ROM },                                            \
  539.     { -1 } /* end of table */                                                \
  540. };
  541.  
  542. #define UNUSED 0x4000
  543. /*                    LOWROM   INPUT    UNK1    UNK2 */
  544. MCU_MEMORY( hopmappy, UNUSED, 0x2000, 0x8000, 0x8800 )
  545. MCU_MEMORY( skykiddx, UNUSED, 0x2000, 0x8000, 0x8800 )
  546. MCU_MEMORY( roishtar, 0x0000, 0x6000, 0x8000, 0x9800 )
  547. MCU_MEMORY( genpeitd, 0x4000, 0x2800, 0xa000, 0xa800 )
  548. MCU_MEMORY( rthunder, 0x4000, 0x2000, 0xb000, 0xb800 )
  549. MCU_MEMORY( wndrmomo, 0x4000, 0x3800, 0xc000, 0xc800 )
  550. #undef UNUSED
  551.  
  552.  
  553. static struct IOReadPort mcu_readport[] =
  554. {
  555.     { HD63701_PORT1, HD63701_PORT1, input_port_4_r },
  556.     { -1 }    /* end of table */
  557. };
  558.  
  559. static struct IOWritePort mcu_writeport[] =
  560. {
  561.     { HD63701_PORT1, HD63701_PORT1, namcos86_coin_w },
  562.     { HD63701_PORT2, HD63701_PORT2, namcos86_led_w },
  563.     { -1 }    /* end of table */
  564. };
  565.  
  566.  
  567. /*******************************************************************/
  568.  
  569. INPUT_PORTS_START( hopmappy )
  570.     PORT_START
  571.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 2 */
  572.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 2 player 1 */
  573.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  574.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  575.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  576.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
  577.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  578.     PORT_BITX( 0x80, 0x80, IPT_SERVICE, "Service Switch", KEYCODE_F1, IP_JOY_NONE )
  579.  
  580.     PORT_START
  581.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 1 */
  582.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 2 player 2 */
  583.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  584.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  585.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
  586.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
  587.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  588.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  589.  
  590.     PORT_START      /* DSWA */
  591.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
  592.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
  593.     PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
  594.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  595.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  596.     PORT_DIPNAME( 0x04, 0x00, "Allow Continue" )
  597.     PORT_DIPSETTING(    0x04, DEF_STR( No ) )
  598.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  599.     PORT_DIPNAME( 0x18, 0x00, DEF_STR( Lives ) )
  600.     PORT_DIPSETTING(    0x08, "1" )
  601.     PORT_DIPSETTING(    0x10, "2" )
  602.     PORT_DIPSETTING(    0x00, "3" )
  603.     PORT_DIPSETTING(    0x18, "5" )
  604.     PORT_DIPNAME( 0x60, 0x00, DEF_STR( Coin_A ) )
  605.     PORT_DIPSETTING(    0x60, DEF_STR( 3C_1C ) )
  606.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  607.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  608.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
  609.     PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
  610.  
  611.     PORT_START      /* DSWB */
  612.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
  613.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  614.     PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
  615.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
  616.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  617.     PORT_DIPSETTING(    0x02, DEF_STR( On ) )
  618.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
  619.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  620.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  621.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
  622.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  623.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  624.     PORT_BITX(    0x10, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Level Select", IP_KEY_NONE, IP_JOY_NONE )
  625.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  626.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  627.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Flip_Screen ) )
  628.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  629.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  630.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
  631.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  632.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  633.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Difficulty ) )
  634.     PORT_DIPSETTING(    0x00, "Easy" )
  635.     PORT_DIPSETTING(    0x80, "Hard" )
  636.  
  637.     PORT_START
  638.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin lockout */
  639.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 1 */
  640.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 2 */
  641.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
  642.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  643.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  644.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  645.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  646. INPUT_PORTS_END
  647.  
  648. INPUT_PORTS_START( skykiddx )
  649.     PORT_START
  650.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 2 */
  651.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  652.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  653.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  654.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  655.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
  656.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  657.     PORT_BITX( 0x80, 0x80, IPT_SERVICE, "Service Switch", KEYCODE_F1, IP_JOY_NONE )
  658.  
  659.     PORT_START
  660.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 1 */
  661.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  662.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  663.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  664.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
  665.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
  666.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  667.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  668.  
  669.     PORT_START      /* DSWA */
  670.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
  671.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
  672.     PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
  673.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  674.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  675.     PORT_DIPNAME( 0x04, 0x00, "Freeze" )
  676.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  677.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  678.     PORT_BITX(    0x08, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Level Select", IP_KEY_NONE, IP_JOY_NONE )
  679.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  680.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  681.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
  682.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  683.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  684.     PORT_DIPNAME( 0x60, 0x00, DEF_STR( Coin_A ) )
  685.     PORT_DIPSETTING(    0x60, DEF_STR( 3C_1C ) )
  686.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  687.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  688.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
  689.     PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
  690.  
  691.     PORT_START      /* DSWB */
  692.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Flip_Screen ) )
  693.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  694.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  695.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
  696.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  697.     PORT_DIPSETTING(    0x02, DEF_STR( On ) )
  698.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
  699.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  700.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  701.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
  702.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  703.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  704.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  705.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  706.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  707.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Bonus_Life ) )
  708.     PORT_DIPSETTING(    0x20, "20000 80000" )
  709.     PORT_DIPSETTING(    0x00, "30000 90000" )
  710.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Lives ) )
  711.     PORT_DIPSETTING(    0x40, "1" )
  712.     PORT_DIPSETTING(    0x80, "2" )
  713.     PORT_DIPSETTING(    0x00, "3" )
  714.     PORT_DIPSETTING(    0xc0, "5" )
  715.  
  716.     PORT_START
  717.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin lockout */
  718.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 1 */
  719.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 2 */
  720.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
  721.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  722.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  723.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  724.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  725. INPUT_PORTS_END
  726.  
  727. INPUT_PORTS_START( roishtar )
  728.     PORT_START
  729.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 2 */
  730.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  731.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN   | IPF_8WAY )
  732.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN  | IPF_8WAY )
  733.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT | IPF_8WAY )
  734.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
  735.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  736.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  737.  
  738.     PORT_START
  739.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 1 */
  740.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
  741.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP | IPF_8WAY )
  742.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP | IPF_8WAY )
  743.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
  744.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
  745.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  746.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  747.  
  748.     PORT_START      /* DSWA */
  749.     PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) )
  750.     PORT_DIPSETTING(    0x07, DEF_STR( 3C_1C ) )
  751.     PORT_DIPSETTING(    0x05, DEF_STR( 2C_1C ) )
  752.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  753.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) )
  754.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  755.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  756.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_5C ) )
  757.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_6C ) )
  758.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
  759.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  760.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  761.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  762.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  763.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  764.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  765.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  766.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  767.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
  768.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  769.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  770.     PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
  771.  
  772.     PORT_START      /* DSWB */
  773.     PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_B ) )
  774.     PORT_DIPSETTING(    0x07, DEF_STR( 3C_1C ) )
  775.     PORT_DIPSETTING(    0x05, DEF_STR( 2C_1C ) )
  776.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  777.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) )
  778.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  779.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
  780.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_5C ) )
  781.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_6C ) )
  782.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
  783.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  784.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  785.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  786.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  787.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  788.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  789.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  790.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  791.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
  792.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  793.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  794.     PORT_DIPNAME( 0x80, 0x00, "Freeze" )
  795.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  796.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  797.  
  798.     PORT_START
  799.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin lockout */
  800.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 1 */
  801.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 2 */
  802.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
  803.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT  | IPF_8WAY )
  804.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT | IPF_8WAY )
  805.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  806.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT | IPF_8WAY )
  807. INPUT_PORTS_END
  808.  
  809. INPUT_PORTS_START( genpeitd )
  810.     PORT_START
  811.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 2 */
  812.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  813.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  814.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
  815.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  816.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
  817.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  818.     PORT_BITX( 0x80, 0x80, IPT_SERVICE, "Service Switch", KEYCODE_F1, IP_JOY_NONE )
  819.  
  820.     PORT_START
  821.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 1 */
  822.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  823.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  824.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
  825.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
  826.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
  827.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  828.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  829.  
  830.     PORT_START      /* DSWA */
  831.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
  832.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
  833.     PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
  834.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  835.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  836.     PORT_DIPNAME( 0x04, 0x00, "Freeze" )
  837.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  838.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  839.     PORT_DIPNAME( 0x08, 0x00, "Allow Continue" )
  840.     PORT_DIPSETTING(    0x08, DEF_STR( No ) )
  841.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  842.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
  843.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  844.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  845.     PORT_DIPNAME( 0x60, 0x00, DEF_STR( Coin_A ) )
  846.     PORT_DIPSETTING(    0x60, DEF_STR( 3C_1C ) )
  847.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  848.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  849.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
  850.     PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
  851.  
  852.     PORT_START      /* DSWB */
  853.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  854.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  855.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  856.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Cabinet ) )
  857.     PORT_DIPSETTING(    0x02, DEF_STR( Upright ) )
  858.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  859.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
  860.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  861.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  862.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
  863.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  864.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  865.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) )
  866.     PORT_DIPSETTING(    0x10, "Easy" )
  867.     PORT_DIPSETTING(    0x00, "Normal" )
  868.     PORT_DIPSETTING(    0x20, "Hard" )
  869.     PORT_DIPSETTING(    0x30, "Hardest" )
  870.     PORT_DIPNAME( 0xc0, 0x00, "Candle" )
  871.     PORT_DIPSETTING(    0x40, "40" )
  872.     PORT_DIPSETTING(    0x00, "50" )
  873.     PORT_DIPSETTING(    0x80, "60" )
  874.     PORT_DIPSETTING(    0xc0, "70" )
  875.  
  876.     PORT_START
  877.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin lockout */
  878.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 1 */
  879.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 2 */
  880.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
  881.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  882.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  883.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  884.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
  885. INPUT_PORTS_END
  886.  
  887. INPUT_PORTS_START( rthunder )
  888.     PORT_START
  889.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 2 */
  890.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  891.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
  892.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_PLAYER2 )
  893.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_PLAYER2 )
  894.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
  895.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  896.     PORT_BITX( 0x80, 0x80, IPT_SERVICE, "Service Switch", KEYCODE_F1, IP_JOY_NONE )
  897.  
  898.     PORT_START
  899.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 1 */
  900.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  901.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
  902.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_PLAYER2 )
  903.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
  904.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
  905.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  906.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  907.  
  908.     PORT_START      /* DSWA */
  909.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
  910.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
  911.     PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
  912.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  913.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  914.     PORT_DIPNAME( 0x04, 0x00, "Freeze" )
  915.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  916.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  917.     PORT_BITX(    0x08, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE )
  918.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  919.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  920.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
  921.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  922.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  923.     PORT_DIPNAME( 0x60, 0x00, DEF_STR( Coin_A ) )
  924.     PORT_DIPSETTING(    0x60, DEF_STR( 3C_1C ) )
  925.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  926.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  927.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
  928.     PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
  929.  
  930.     PORT_START      /* DSWB */
  931.     PORT_DIPNAME( 0x01, 0x00, "Continues" )
  932.     PORT_DIPSETTING(    0x01, "3" )
  933.     PORT_DIPSETTING(    0x00, "6" )
  934.     PORT_DIPNAME( 0x06, 0x00, DEF_STR( Cabinet ) )
  935.     PORT_DIPSETTING(    0x00, "Upright 1 Player" )
  936. /*    PORT_DIPSETTING(    0x04, "Upright 1 Player" ) */
  937.     PORT_DIPSETTING(    0x02, "Upright 2 Players" )
  938.     PORT_DIPSETTING(    0x06, DEF_STR( Cocktail ) )
  939.     PORT_DIPNAME( 0x08, 0x08, "Level Select" )
  940.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  941.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  942.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Difficulty ) )
  943.     PORT_DIPSETTING(    0x00, "Normal" )
  944.     PORT_DIPSETTING(    0x10, "Easy" )
  945.     PORT_DIPNAME( 0x20, 0x20, "Timer value" )
  946.     PORT_DIPSETTING(    0x00, "120 secs" )
  947.     PORT_DIPSETTING(    0x20, "150 secs" )
  948.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Bonus_Life ) )
  949.     PORT_DIPSETTING(    0x00, "70k, 200k" )
  950.     PORT_DIPSETTING(    0x40, "100k, 300k" )
  951.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Lives ) )
  952.     PORT_DIPSETTING(    0x00, "3" )
  953.     PORT_DIPSETTING(    0x80, "5" )
  954.  
  955.     PORT_START
  956.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin lockout */
  957.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 1 */
  958.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 2 */
  959.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
  960.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
  961.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  962.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  963.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_PLAYER2 )
  964. INPUT_PORTS_END
  965.  
  966. INPUT_PORTS_START( rthundro )
  967.     PORT_START
  968.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 2 */
  969.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  970.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
  971.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_PLAYER2 )
  972.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_PLAYER2 )
  973.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
  974.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  975.     PORT_BITX( 0x80, 0x80, IPT_SERVICE, "Service Switch", KEYCODE_F1, IP_JOY_NONE )
  976.  
  977.     PORT_START
  978.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 1 */
  979.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  980.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
  981.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_PLAYER2 )
  982.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
  983.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
  984.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  985.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  986.  
  987.     PORT_START      /* DSWA */
  988.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
  989.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
  990.     PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
  991.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  992.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  993.     PORT_DIPNAME( 0x04, 0x00, "Freeze" )
  994.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  995.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  996.     PORT_BITX(    0x08, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE )
  997.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  998.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  999.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
  1000.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  1001.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  1002.     PORT_DIPNAME( 0x60, 0x00, DEF_STR( Coin_A ) )
  1003.     PORT_DIPSETTING(    0x60, DEF_STR( 3C_1C ) )
  1004.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  1005.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  1006.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
  1007.     PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
  1008.  
  1009.     PORT_START      /* DSWB */
  1010.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  1011.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  1012.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  1013.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Cabinet ) )
  1014.     PORT_DIPSETTING(    0x02, DEF_STR( Upright ) )
  1015.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  1016.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
  1017.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1018.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  1019.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
  1020.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1021.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  1022.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  1023.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1024.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  1025.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  1026.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1027.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  1028.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Lives ) )
  1029.     PORT_DIPSETTING(    0x40, "1" )
  1030.     PORT_DIPSETTING(    0x80, "2" )
  1031.     PORT_DIPSETTING(    0x00, "3" )
  1032.     PORT_DIPSETTING(    0xc0, "5" )
  1033.  
  1034.     PORT_START
  1035.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin lockout */
  1036.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 1 */
  1037.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 2 */
  1038.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
  1039.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
  1040.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  1041.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  1042.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_PLAYER2 )
  1043. INPUT_PORTS_END
  1044.  
  1045. INPUT_PORTS_START( wndrmomo )
  1046.     PORT_START
  1047.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 2 */
  1048.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  1049.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
  1050.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_PLAYER2 )
  1051.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_PLAYER2 )
  1052.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
  1053.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  1054.     PORT_BITX( 0x80, 0x80, IPT_SERVICE, "Service Switch", KEYCODE_F1, IP_JOY_NONE )
  1055.  
  1056.     PORT_START
  1057.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* button 3 player 1 */
  1058.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  1059.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
  1060.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_PLAYER2 )
  1061.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
  1062.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
  1063.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  1064.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  1065.  
  1066.     PORT_START      /* DSWA */
  1067.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
  1068.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
  1069.     PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
  1070.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  1071.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  1072.     PORT_DIPNAME( 0x04, 0x00, "Freeze" )
  1073.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1074.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  1075.     PORT_DIPNAME( 0x08, 0x08, "Level Select" )
  1076.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1077.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  1078.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
  1079.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  1080.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  1081.     PORT_DIPNAME( 0x60, 0x00, DEF_STR( Coin_A ) )
  1082.     PORT_DIPSETTING(    0x60, DEF_STR( 3C_1C ) )
  1083.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
  1084.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  1085.     PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
  1086.     PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
  1087.  
  1088.     PORT_START      /* DSWB */
  1089.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  1090.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  1091.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  1092.     PORT_DIPNAME( 0x06, 0x00, DEF_STR( Cabinet ) )
  1093.     PORT_DIPSETTING(    0x00, "Type A" )
  1094.     PORT_DIPSETTING(    0x02, "Type B" )
  1095.     PORT_DIPSETTING(    0x04, "Type C" )
  1096. //    PORT_DIPSETTING(    0x06, "Type A" )
  1097.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
  1098.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1099.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  1100.     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
  1101.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1102.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  1103.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )
  1104.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1105.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  1106.     PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
  1107.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1108.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  1109.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
  1110.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1111.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  1112.  
  1113.     PORT_START
  1114.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin lockout */
  1115.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 1 */
  1116.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL )    /* OUT:coin counter 2 */
  1117.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 )
  1118.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
  1119.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  1120.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  1121.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_PLAYER2 )
  1122. INPUT_PORTS_END
  1123.  
  1124.  
  1125. /*******************************************************************/
  1126.  
  1127. #define TILELAYOUT(NUM) static struct GfxLayout tilelayout_##NUM =  \
  1128. {                                                                   \
  1129.     8,8,    /* 8*8 characters */                                    \
  1130.     NUM,    /* NUM characters */                                    \
  1131.     3,    /* 3 bits per pixel */                                      \
  1132.     { 2*NUM*8*8, NUM*8*8, 0 },                                      \
  1133.     { 0, 1, 2, 3, 4, 5, 6, 7 },                                     \
  1134.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },                     \
  1135.     8*8    /* every char takes 8 consecutive bytes */                  \
  1136. }
  1137.  
  1138. TILELAYOUT(1024);
  1139. TILELAYOUT(2048);
  1140. TILELAYOUT(4096);
  1141.  
  1142. #define SPRITELAYOUT(NUM) static struct GfxLayout spritelayout_##NUM =         \
  1143. {                                                                               \
  1144.     16,16,    /* 16*16 sprites */                                                   \
  1145.     NUM,    /* NUM sprites */                                                   \
  1146.     4,    /* 4 bitss per pixel */                                                   \
  1147.     { 0, 1, 2, 3 },                                                               \
  1148.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,                                   \
  1149.             8*4, 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4 },                       \
  1150.     { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,                           \
  1151.             8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },               \
  1152.     16*64                                                                       \
  1153. }
  1154.  
  1155. SPRITELAYOUT(256);
  1156. SPRITELAYOUT(512);
  1157. SPRITELAYOUT(1024);
  1158.  
  1159.  
  1160. #define GFXDECODE(CHAR1,CHAR2,SPRITE)                                        \
  1161. static struct GfxDecodeInfo gfxdecodeinfo_##CHAR1##_##CHAR2##_##SPRITE[] =    \
  1162. {                                                                            \
  1163.     { REGION_GFX1, 0x00000,      &tilelayout_##CHAR1,    2048*0, 256 },        \
  1164.     { REGION_GFX2, 0x00000,      &tilelayout_##CHAR2,    2048*0, 256 },        \
  1165.     { REGION_GFX3, 0*128*SPRITE, &spritelayout_##SPRITE, 2048*1, 128 },        \
  1166.     { REGION_GFX3, 1*128*SPRITE, &spritelayout_##SPRITE, 2048*1, 128 },        \
  1167.     { REGION_GFX3, 2*128*SPRITE, &spritelayout_##SPRITE, 2048*1, 128 },        \
  1168.     { REGION_GFX3, 3*128*SPRITE, &spritelayout_##SPRITE, 2048*1, 128 },        \
  1169.     { REGION_GFX3, 4*128*SPRITE, &spritelayout_##SPRITE, 2048*1, 128 },        \
  1170.     { REGION_GFX3, 5*128*SPRITE, &spritelayout_##SPRITE, 2048*1, 128 },        \
  1171.     { REGION_GFX3, 6*128*SPRITE, &spritelayout_##SPRITE, 2048*1, 128 },        \
  1172.     { REGION_GFX3, 7*128*SPRITE, &spritelayout_##SPRITE, 2048*1, 128 },        \
  1173.     { -1 }                                                                    \
  1174. };
  1175.  
  1176. GFXDECODE(1024,1024, 256)
  1177. GFXDECODE(2048,2048, 256)
  1178. GFXDECODE(2048,2048, 512)
  1179. GFXDECODE(4096,2048, 512)
  1180. GFXDECODE(4096,2048,1024)
  1181.  
  1182. /*******************************************************************/
  1183.  
  1184. static struct YM2151interface ym2151_interface =
  1185. {
  1186.     1,                      /* 1 chip */
  1187.     3579580,                /* 3.579580 MHz ? */
  1188.     { YM3012_VOL(0,MIXER_PAN_CENTER,60,MIXER_PAN_CENTER) },    /* only right channel is connected */
  1189.     { 0 },
  1190.     { 0 }
  1191. };
  1192.  
  1193. static struct namco_interface namco_interface =
  1194. {
  1195.     49152000/2048,         /* 24000Hz */
  1196.     8,        /* number of voices */
  1197.     50,     /* playback volume */
  1198.     -1,        /* memory region */
  1199.     0        /* stereo */
  1200. };
  1201.  
  1202. static struct Samplesinterface samples_interface =
  1203. {
  1204.     2,    /* 2 channels for voice effects */
  1205.     40    /* volume */
  1206. };
  1207.  
  1208. static struct CustomSound_interface custom_interface =
  1209. {
  1210.     rt_decode_sample,
  1211.     0,
  1212.     0
  1213. };
  1214.  
  1215.  
  1216. static void namco86_init_machine( void )
  1217. {
  1218.     unsigned char *base = memory_region(REGION_CPU1) + 0x10000;
  1219.  
  1220.     cpu_setbank(1,base);
  1221.  
  1222.     int_enabled[0] = int_enabled[1] = 1;
  1223. }
  1224.  
  1225.  
  1226. #define MACHINE_DRIVER(NAME,GFX)                                                \
  1227. static struct MachineDriver machine_driver_##NAME =                                \
  1228. {                                                                                \
  1229.     {                                                                            \
  1230.         {                                                                        \
  1231.             CPU_M6809,                                                            \
  1232.             6000000/4,        /* ? */                                                \
  1233.             /*49152000/32, rthunder doesn't work with this */                    \
  1234.             readmem1,writemem1,0,0,                                                \
  1235.             namco86_interrupt1,1                                                \
  1236.         },                                                                        \
  1237.         {                                                                        \
  1238.             CPU_M6809,                                                            \
  1239.             49152000/32,         /* ? */                                            \
  1240.             NAME##_readmem2,NAME##_writemem2,0,0,                                \
  1241.             namco86_interrupt2,1                                                \
  1242.         },                                                                        \
  1243.         {                                                                        \
  1244.             CPU_HD63701,    /* or compatible 6808 with extra instructions */    \
  1245.             49152000/32,         /* ? */                                            \
  1246.             NAME##_mcu_readmem,NAME##_mcu_writemem,mcu_readport,mcu_writeport,    \
  1247.             interrupt, 1    /* ??? */                                            \
  1248.         }                                                                        \
  1249.     },                                                                            \
  1250.     60, DEFAULT_60HZ_VBLANK_DURATION,                                            \
  1251.     100, /* cpu slices */                                                        \
  1252.     namco86_init_machine, /* init machine */                                    \
  1253.                                                                                 \
  1254.     /* video hardware */                                                        \
  1255.     36*8, 28*8, { 0*8, 36*8-1, 0*8, 28*8-1 },                                    \
  1256.     gfxdecodeinfo_##GFX,                                                        \
  1257.     512,4096,                                                                    \
  1258.     namcos86_vh_convert_color_prom,                                                \
  1259.                                                                                 \
  1260.     VIDEO_TYPE_RASTER,                                                            \
  1261.     0,                                                                            \
  1262.     namcos86_vh_start,                                                            \
  1263.     0,                                                                            \
  1264.     namcos86_vh_screenrefresh,                                                    \
  1265.                                                                                 \
  1266.     /* sound hardware */                                                        \
  1267.     0,0,0,0,                                                                    \
  1268.     {                                                                            \
  1269.         {                                                                        \
  1270.             SOUND_YM2151,                                                        \
  1271.             &ym2151_interface                                                    \
  1272.         },                                                                        \
  1273.         {                                                                        \
  1274.             SOUND_NAMCO,                                                        \
  1275.             &namco_interface                                                    \
  1276.         },                                                                        \
  1277.         {                                                                        \
  1278.             SOUND_SAMPLES,                                                        \
  1279.             &samples_interface                                                    \
  1280.         },                                                                        \
  1281.         {                                                                        \
  1282.             SOUND_CUSTOM,    /* actually initializes the samples */                \
  1283.             &custom_interface                                                    \
  1284.         }                                                                        \
  1285.     }                                                                            \
  1286. };
  1287.  
  1288.  
  1289. MACHINE_DRIVER( hopmappy, 1024_1024_256 )
  1290. MACHINE_DRIVER( skykiddx, 2048_2048_256 )
  1291. MACHINE_DRIVER( roishtar, 1024_1024_256 )
  1292. MACHINE_DRIVER( genpeitd, 4096_2048_1024 )
  1293. MACHINE_DRIVER( rthunder, 4096_2048_512 )
  1294. MACHINE_DRIVER( wndrmomo, 2048_2048_512 )
  1295.  
  1296.  
  1297. /***************************************************************************
  1298.  
  1299.   Game driver(s)
  1300.  
  1301. ***************************************************************************/
  1302.  
  1303. ROM_START( hopmappy )
  1304.     ROM_REGION( 0x18000, REGION_CPU1 )
  1305.     ROM_LOAD( "hm1",         0x08000, 0x8000, 0x1a83914e )
  1306.     /* 9d empty */
  1307.  
  1308.     /* the CPU1 ROM expansion board is not present in this game */
  1309.  
  1310.     ROM_REGION( 0x18000, REGION_CPU2 )
  1311.     ROM_LOAD( "hm2",         0xc000, 0x4000, 0xc46cda65 )
  1312.     /* 12d empty */
  1313.  
  1314.     ROM_REGION( 0x06000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1315.     ROM_LOAD( "hm6",         0x00000, 0x04000, 0xfd0e8887 )    /* plane 1,2 */
  1316.     /* no plane 3 */
  1317.  
  1318.     ROM_REGION( 0x06000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1319.     ROM_LOAD( "hm5",         0x00000, 0x04000, 0x9c4f31ae )    /* plane 1,2 */
  1320.     /* no plane 3 */
  1321.  
  1322.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  1323.     ROM_LOAD( "hm4",         0x00000, 0x8000, 0x78719c52 )
  1324.     /* 12k/l/m/p/r/t/u empty */
  1325.  
  1326.     ROM_REGION( 0x1420, REGION_PROMS )
  1327.     ROM_LOAD( "hm11.bpr",    0x0000, 0x0200, 0xcc801088 )    /* red & green components */
  1328.     ROM_LOAD( "hm12.bpr",    0x0200, 0x0200, 0xa1cb71c5 )    /* blue component */
  1329.     ROM_LOAD( "hm13.bpr",    0x0400, 0x0800, 0xe362d613 )    /* tiles colortable */
  1330.     ROM_LOAD( "hm14.bpr",    0x0c00, 0x0800, 0x678252b4 )    /* sprites colortable */
  1331.     ROM_LOAD( "hm15.bpr",    0x1400, 0x0020, 0x475bf500 )    /* tile address decoder (used at runtime) */
  1332.  
  1333.     ROM_REGION( 0x10000, REGION_CPU3 )
  1334.     ROM_LOAD( "hm3",         0x08000, 0x2000, 0x6496e1db )
  1335.     ROM_LOAD( "pl1-mcu.bin", 0x0f000, 0x1000, 0x6ef08fb3 )
  1336.  
  1337.     /* the PCM expansion board is not present in this game */
  1338. ROM_END
  1339.  
  1340. ROM_START( skykiddx )
  1341.     ROM_REGION( 0x18000, REGION_CPU1 )
  1342.     ROM_LOAD( "sk3_1b.9c", 0x08000, 0x8000, 0x767b3514 )
  1343.     ROM_LOAD( "sk3_2.9d",  0x10000, 0x8000, 0x74b8f8e2 )
  1344.  
  1345.     /* the CPU1 ROM expansion board is not present in this game */
  1346.  
  1347.     ROM_REGION( 0x18000, REGION_CPU2 )
  1348.     ROM_LOAD( "sk3_3.12c", 0x8000, 0x8000, 0x6d1084c4 )
  1349.     /* 12d empty */
  1350.  
  1351.     ROM_REGION( 0x0c000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1352.     ROM_LOAD( "sk3_9.7r",  0x00000, 0x08000, 0x48675b17 )    /* plane 1,2 */
  1353.     ROM_LOAD( "sk3_10.7s", 0x08000, 0x04000, 0x7418465a )    /* plane 3 */
  1354.  
  1355.     ROM_REGION( 0x0c000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1356.     ROM_LOAD( "sk3_7.4r",  0x00000, 0x08000, 0x4036b735 )    /* plane 1,2 */
  1357.     ROM_LOAD( "sk3_8.4s",  0x08000, 0x04000, 0x044bfd21 )    /* plane 3 */
  1358.  
  1359.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  1360.     ROM_LOAD( "sk3_5.12h",  0x00000, 0x8000, 0x5c7d4399 )
  1361.     ROM_LOAD( "sk3_6.12k",  0x08000, 0x8000, 0xc908a3b2 )
  1362.     /* 12l/m/p/r/t/u empty */
  1363.  
  1364.     ROM_REGION( 0x1420, REGION_PROMS )
  1365.     ROM_LOAD( "sk3-1.3r", 0x0000, 0x0200, 0x9e81dedd )    /* red & green components */
  1366.     ROM_LOAD( "sk3-2.3s", 0x0200, 0x0200, 0xcbfec4dd )    /* blue component */
  1367.     ROM_LOAD( "sk3-3.4v", 0x0400, 0x0800, 0x81714109 )    /* tiles colortable */
  1368.     ROM_LOAD( "sk3-4.5v", 0x0c00, 0x0800, 0x1bf25acc )    /* sprites colortable */
  1369.     ROM_LOAD( "sk3-5.6u", 0x1400, 0x0020, 0xe4130804 )    /* tile address decoder (used at runtime) */
  1370.  
  1371.     ROM_REGION( 0x10000, REGION_CPU3 )
  1372.     ROM_LOAD( "sk3_4.6b",    0x08000, 0x4000, 0xe6cae2d6 )
  1373.     ROM_LOAD( "rt1-mcu.bin", 0x0f000, 0x1000, 0x6ef08fb3 )
  1374.  
  1375.     /* the PCM expansion board is not present in this game */
  1376. ROM_END
  1377.  
  1378. ROM_START( skykiddo )
  1379.     ROM_REGION( 0x18000, REGION_CPU1 )
  1380.     ROM_LOAD( "sk3-1.9c",  0x08000, 0x8000, 0x5722a291 )
  1381.     ROM_LOAD( "sk3_2.9d",  0x10000, 0x8000, 0x74b8f8e2 )
  1382.  
  1383.     /* the CPU1 ROM expansion board is not present in this game */
  1384.  
  1385.     ROM_REGION( 0x18000, REGION_CPU2 )
  1386.     ROM_LOAD( "sk3_3.12c", 0x8000, 0x8000, 0x6d1084c4 )
  1387.     /* 12d empty */
  1388.  
  1389.     ROM_REGION( 0x0c000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1390.     ROM_LOAD( "sk3_9.7r",  0x00000, 0x08000, 0x48675b17 )    /* plane 1,2 */
  1391.     ROM_LOAD( "sk3_10.7s", 0x08000, 0x04000, 0x7418465a )    /* plane 3 */
  1392.  
  1393.     ROM_REGION( 0x0c000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1394.     ROM_LOAD( "sk3_7.4r",  0x00000, 0x08000, 0x4036b735 )    /* plane 1,2 */
  1395.     ROM_LOAD( "sk3_8.4s",  0x08000, 0x04000, 0x044bfd21 )    /* plane 3 */
  1396.  
  1397.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  1398.     ROM_LOAD( "sk3_5.12h",  0x00000, 0x8000, 0x5c7d4399 )
  1399.     ROM_LOAD( "sk3_6.12k",  0x08000, 0x8000, 0xc908a3b2 )
  1400.     /* 12l/m/p/r/t/u empty */
  1401.  
  1402.     ROM_REGION( 0x1420, REGION_PROMS )
  1403.     ROM_LOAD( "sk3-1.3r", 0x0000, 0x0200, 0x9e81dedd )    /* red & green components */
  1404.     ROM_LOAD( "sk3-2.3s", 0x0200, 0x0200, 0xcbfec4dd )    /* blue component */
  1405.     ROM_LOAD( "sk3-3.4v", 0x0400, 0x0800, 0x81714109 )    /* tiles colortable */
  1406.     ROM_LOAD( "sk3-4.5v", 0x0c00, 0x0800, 0x1bf25acc )    /* sprites colortable */
  1407.     ROM_LOAD( "sk3-5.6u", 0x1400, 0x0020, 0xe4130804 )    /* tile address decoder (used at runtime) */
  1408.  
  1409.     ROM_REGION( 0x10000, REGION_CPU3 )
  1410.     ROM_LOAD( "sk3_4.6b",    0x08000, 0x4000, 0xe6cae2d6 )
  1411.     ROM_LOAD( "rt1-mcu.bin", 0x0f000, 0x1000, 0x6ef08fb3 )
  1412.  
  1413.     /* the PCM expansion board is not present in this game */
  1414. ROM_END
  1415.  
  1416. ROM_START( roishtar )
  1417.     ROM_REGION( 0x18000, REGION_CPU1 )
  1418.     ROM_LOAD( "ri1-1c.9c", 0x08000, 0x8000, 0x14acbacb )
  1419.     ROM_LOAD( "ri1-2.9d",  0x14000, 0x2000, 0xfcd58d91 )
  1420.  
  1421.     /* the CPU1 ROM expansion board is not present in this game */
  1422.  
  1423.     ROM_REGION( 0x18000, REGION_CPU2 )
  1424.     ROM_LOAD( "ri1-3.12c", 0x8000, 0x8000, 0xa39829f7 )
  1425.     /* 12d empty */
  1426.  
  1427.     ROM_REGION( 0x06000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1428.     ROM_LOAD( "ri1-14.7r", 0x00000, 0x04000, 0xde8154b4 )    /* plane 1,2 */
  1429.     ROM_LOAD( "ri1-15.7s", 0x04000, 0x02000, 0x4298822b )    /* plane 3 */
  1430.  
  1431.     ROM_REGION( 0x06000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1432.     ROM_LOAD( "ri1-12.4r", 0x00000, 0x04000, 0x557e54d3 )    /* plane 1,2 */
  1433.     ROM_LOAD( "ri1-13.4s", 0x04000, 0x02000, 0x9ebe8e32 )    /* plane 3 */
  1434.  
  1435.     ROM_REGION( 0x40000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  1436.     ROM_LOAD( "ri1-5.12h",  0x00000, 0x8000, 0x46b59239 )
  1437.     ROM_LOAD( "ri1-6.12k",  0x08000, 0x8000, 0x94d9ef48 )
  1438.     ROM_LOAD( "ri1-7.12l",  0x10000, 0x8000, 0xda802b59 )
  1439.     ROM_LOAD( "ri1-8.12m",  0x18000, 0x8000, 0x16b88b74 )
  1440.     ROM_LOAD( "ri1-9.12p",  0x20000, 0x8000, 0xf3de3c2a )
  1441.     ROM_LOAD( "ri1-10.12r", 0x28000, 0x8000, 0x6dacc70d )
  1442.     ROM_LOAD( "ri1-11.12t", 0x30000, 0x8000, 0xfb6bc533 )
  1443.     /* 12u empty */
  1444.  
  1445.     ROM_REGION( 0x1420, REGION_PROMS )
  1446.     ROM_LOAD( "ri1-1.3r", 0x0000, 0x0200, 0x29cd0400 )    /* red & green components */
  1447.     ROM_LOAD( "ri1-2.3s", 0x0200, 0x0200, 0x02fd278d )    /* blue component */
  1448.     ROM_LOAD( "ri1-3.4v", 0x0400, 0x0800, 0xcbd7e53f )    /* tiles colortable */
  1449.     ROM_LOAD( "ri1-4.5v", 0x0c00, 0x0800, 0x22921617 )    /* sprites colortable */
  1450.     ROM_LOAD( "ri1-5.6u", 0x1400, 0x0020, 0xe2188075 )    /* tile address decoder (used at runtime) */
  1451.  
  1452.     ROM_REGION( 0x10000, REGION_CPU3 )
  1453.     ROM_LOAD( "ri1-4.6b",    0x00000, 0x4000, 0x552172b8 )
  1454.     ROM_CONTINUE(            0x08000, 0x4000 )
  1455.     ROM_LOAD( "rt1-mcu.bin", 0x0f000, 0x1000, 0x6ef08fb3 )
  1456.  
  1457.     /* the PCM expansion board is not present in this game */
  1458. ROM_END
  1459.  
  1460. ROM_START( genpeitd )
  1461.     ROM_REGION( 0x18000, REGION_CPU1 )
  1462.     ROM_LOAD( "gt1-1b.9c", 0x08000, 0x8000, 0x75396194 )
  1463.     /* 9d empty */
  1464.  
  1465.     ROM_REGION( 0x40000, REGION_USER1 ) /* bank switched data for CPU1 */
  1466.     ROM_LOAD( "gt1-10b.f1",  0x00000, 0x10000, 0x5721ad0d )
  1467.     /* h1 empty */
  1468.     /* k1 empty */
  1469.     /* m1 empty */
  1470.  
  1471.     ROM_REGION( 0x18000, REGION_CPU2 )
  1472.     ROM_LOAD( "gt1-2.12c", 0xc000, 0x4000, 0x302f2cb6 )
  1473.     /* 12d empty */
  1474.  
  1475.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1476.     ROM_LOAD( "gt1-7.7r", 0x00000, 0x10000, 0xea77a211 )    /* plane 1,2 */
  1477.     ROM_LOAD( "gt1-6.7s", 0x10000, 0x08000, 0x1b128a2e )    /* plane 3 */
  1478.  
  1479.     ROM_REGION( 0x0c000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1480.     ROM_LOAD( "gt1-5.4r", 0x00000, 0x08000, 0x44d58b06 )    /* plane 1,2 */
  1481.     ROM_LOAD( "gt1-4.4s", 0x08000, 0x04000, 0xdb8d45b0 )    /* plane 3 */
  1482.  
  1483.     ROM_REGION( 0x100000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  1484.     ROM_LOAD( "gt1-11.12h",  0x00000, 0x20000, 0x3181a5fe )
  1485.     ROM_LOAD( "gt1-12.12k",  0x20000, 0x20000, 0x76b729ab )
  1486.     ROM_LOAD( "gt1-13.12l",  0x40000, 0x20000, 0xe332a36e )
  1487.     ROM_LOAD( "gt1-14.12m",  0x60000, 0x20000, 0xe5ffaef5 )
  1488.     ROM_LOAD( "gt1-15.12p",  0x80000, 0x20000, 0x198b6878 )
  1489.     ROM_LOAD( "gt1-16.12r",  0xa0000, 0x20000, 0x801e29c7 )
  1490.     ROM_LOAD( "gt1-8.12t",   0xc0000, 0x10000, 0xad7bc770 )
  1491.     ROM_LOAD( "gt1-9.12u",   0xe0000, 0x10000, 0xd95a5fd7 )
  1492.  
  1493.     ROM_REGION( 0x1420, REGION_PROMS )
  1494.     ROM_LOAD( "gt1-1.3r", 0x0000, 0x0200, 0x2f0ddddb )    /* red & green components */
  1495.     ROM_LOAD( "gt1-2.3s", 0x0200, 0x0200, 0x87d27025 )    /* blue component */
  1496.     ROM_LOAD( "gt1-3.4v", 0x0400, 0x0800, 0xc178de99 )    /* tiles colortable */
  1497.     ROM_LOAD( "gt1-4.5v", 0x0c00, 0x0800, 0x9f48ef17 )    /* sprites colortable */
  1498.     ROM_LOAD( "gt1-5.6u", 0x1400, 0x0020, 0xe4130804 )    /* tile address decoder (used at runtime) */
  1499.  
  1500.     ROM_REGION( 0x10000, REGION_CPU3 )
  1501.     ROM_LOAD( "gt1-3.6b",    0x04000, 0x8000, 0x315cd988 )
  1502.     ROM_LOAD( "rt1-mcu.bin", 0x0f000, 0x1000, 0x6ef08fb3 )
  1503.  
  1504.     ROM_REGION( 0x80000, REGION_SOUND1 ) /* PCM samples for Hitachi CPU */
  1505.     ROM_LOAD( "gt1-17.f3",  0x00000, 0x20000, 0x26181ff8 )
  1506.     ROM_LOAD( "gt1-18.h3",  0x20000, 0x20000, 0x7ef9e5ea )
  1507.     ROM_LOAD( "gt1-19.k3",  0x40000, 0x20000, 0x38e11f6c )
  1508.     /* m3 empty */
  1509. ROM_END
  1510.  
  1511. ROM_START( rthunder )
  1512.     ROM_REGION( 0x18000, REGION_CPU1 )
  1513.     ROM_LOAD( "rt3-1b.9c",  0x8000, 0x8000, 0x7d252a1b )
  1514.     /* 9d empty */
  1515.  
  1516.     ROM_REGION( 0x40000, REGION_USER1 ) /* bank switched data for CPU1 */
  1517.     ROM_LOAD( "rt1-17.f1",  0x00000, 0x10000, 0x766af455 )
  1518.     ROM_LOAD( "rt1-18.h1",  0x10000, 0x10000, 0x3f9f2f5d )
  1519.     ROM_LOAD( "rt1-19.k1",  0x20000, 0x10000, 0xc16675e9 )
  1520.     ROM_LOAD( "rt1-20.m1",  0x30000, 0x10000, 0xc470681b )
  1521.  
  1522.     ROM_REGION( 0x18000, REGION_CPU2 )
  1523.     ROM_LOAD( "rt3-2b.12c", 0x08000, 0x8000, 0xa7ea46ee )
  1524.     ROM_LOAD( "rt3-3.12d",  0x10000, 0x8000, 0xa13f601c )
  1525.  
  1526.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1527.     ROM_LOAD( "rt1-7.7r",  0x00000, 0x10000, 0xa85efa39 )    /* plane 1,2 */
  1528.     ROM_LOAD( "rt1-8.7s",  0x10000, 0x08000, 0xf7a95820 )    /* plane 3 */
  1529.  
  1530.     ROM_REGION( 0x0c000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1531.     ROM_LOAD( "rt1-5.4r",  0x00000, 0x08000, 0xd0fc470b )    /* plane 1,2 */
  1532.     ROM_LOAD( "rt1-6.4s",  0x08000, 0x04000, 0x6b57edb2 )    /* plane 3 */
  1533.  
  1534.     ROM_REGION( 0x80000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  1535.     ROM_LOAD( "rt1-9.12h",  0x00000, 0x10000, 0x8e070561 )
  1536.     ROM_LOAD( "rt1-10.12k", 0x10000, 0x10000, 0xcb8fb607 )
  1537.     ROM_LOAD( "rt1-11.12l", 0x20000, 0x10000, 0x2bdf5ed9 )
  1538.     ROM_LOAD( "rt1-12.12m", 0x30000, 0x10000, 0xe6c6c7dc )
  1539.     ROM_LOAD( "rt1-13.12p", 0x40000, 0x10000, 0x489686d7 )
  1540.     ROM_LOAD( "rt1-14.12r", 0x50000, 0x10000, 0x689e56a8 )
  1541.     ROM_LOAD( "rt1-15.12t", 0x60000, 0x10000, 0x1d8bf2ca )
  1542.     ROM_LOAD( "rt1-16.12u", 0x70000, 0x10000, 0x1bbcf37b )
  1543.  
  1544.     ROM_REGION( 0x1420, REGION_PROMS )
  1545.     ROM_LOAD( "mb7124e.3r", 0x0000, 0x0200, 0x8ef3bb9d )    /* red & green components */
  1546.     ROM_LOAD( "mb7116e.3s", 0x0200, 0x0200, 0x6510a8f2 )    /* blue component */
  1547.     ROM_LOAD( "mb7138h.4v", 0x0400, 0x0800, 0x95c7d944 )    /* tiles colortable */
  1548.     ROM_LOAD( "mb7138h.6v", 0x0c00, 0x0800, 0x1391fec9 )    /* sprites colortable */
  1549.     ROM_LOAD( "mb7112e.6u", 0x1400, 0x0020, 0xe4130804 )    /* tile address decoder (used at runtime) */
  1550.  
  1551.     ROM_REGION( 0x10000, REGION_CPU3 )
  1552.     ROM_LOAD( "rt1-4.6b",    0x04000, 0x8000, 0x00cf293f )
  1553.     ROM_LOAD( "rt1-mcu.bin", 0x0f000, 0x1000, 0x6ef08fb3 )
  1554.  
  1555.     ROM_REGION( 0x40000, REGION_SOUND1 ) /* PCM samples for Hitachi CPU */
  1556.     ROM_LOAD( "rt1-21.f3",  0x00000, 0x10000, 0x454968f3 )
  1557.     ROM_LOAD( "rt1-22.h3",  0x10000, 0x10000, 0xfe963e72 )
  1558.     /* k3 empty */
  1559.     /* m3 empty */
  1560. ROM_END
  1561.  
  1562. ROM_START( rthundro )
  1563.     ROM_REGION( 0x18000, REGION_CPU1 )
  1564.     ROM_LOAD( "r1",         0x8000, 0x8000, 0x6f8c1252 )
  1565.     /* 9d empty */
  1566.  
  1567.     ROM_REGION( 0x40000, REGION_USER1 ) /* bank switched data for CPU1 */
  1568.     ROM_LOAD( "rt1-17.f1",  0x00000, 0x10000, 0x766af455 )
  1569.     ROM_LOAD( "rt1-18.h1",  0x10000, 0x10000, 0x3f9f2f5d )
  1570.     ROM_LOAD( "r19",        0x20000, 0x10000, 0xfe9343b0 )
  1571.     ROM_LOAD( "r20",        0x30000, 0x10000, 0xf8518d4f )
  1572.  
  1573.     ROM_REGION( 0x18000, REGION_CPU2 )
  1574.     ROM_LOAD( "r2",        0x08000, 0x8000, 0xf22a03d8 )
  1575.     ROM_LOAD( "r3",        0x10000, 0x8000, 0xaaa82885 )
  1576.  
  1577.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1578.     ROM_LOAD( "rt1-7.7r",  0x00000, 0x10000, 0xa85efa39 )    /* plane 1,2 */
  1579.     ROM_LOAD( "rt1-8.7s",  0x10000, 0x08000, 0xf7a95820 )    /* plane 3 */
  1580.  
  1581.     ROM_REGION( 0x0c000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1582.     ROM_LOAD( "rt1-5.4r",  0x00000, 0x08000, 0xd0fc470b )    /* plane 1,2 */
  1583.     ROM_LOAD( "rt1-6.4s",  0x08000, 0x04000, 0x6b57edb2 )    /* plane 3 */
  1584.  
  1585.     ROM_REGION( 0x80000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  1586.     ROM_LOAD( "rt1-9.12h",  0x00000, 0x10000, 0x8e070561 )
  1587.     ROM_LOAD( "rt1-10.12k", 0x10000, 0x10000, 0xcb8fb607 )
  1588.     ROM_LOAD( "rt1-11.12l", 0x20000, 0x10000, 0x2bdf5ed9 )
  1589.     ROM_LOAD( "rt1-12.12m", 0x30000, 0x10000, 0xe6c6c7dc )
  1590.     ROM_LOAD( "rt1-13.12p", 0x40000, 0x10000, 0x489686d7 )
  1591.     ROM_LOAD( "rt1-14.12r", 0x50000, 0x10000, 0x689e56a8 )
  1592.     ROM_LOAD( "rt1-15.12t", 0x60000, 0x10000, 0x1d8bf2ca )
  1593.     ROM_LOAD( "rt1-16.12u", 0x70000, 0x10000, 0x1bbcf37b )
  1594.  
  1595.     ROM_REGION( 0x1420, REGION_PROMS )
  1596.     ROM_LOAD( "mb7124e.3r", 0x0000, 0x0200, 0x8ef3bb9d )    /* red & green components */
  1597.     ROM_LOAD( "mb7116e.3s", 0x0200, 0x0200, 0x6510a8f2 )    /* blue component */
  1598.     ROM_LOAD( "mb7138h.4v", 0x0400, 0x0800, 0x95c7d944 )    /* tiles colortable */
  1599.     ROM_LOAD( "mb7138h.6v", 0x0c00, 0x0800, 0x1391fec9 )    /* sprites colortable */
  1600.     ROM_LOAD( "mb7112e.6u", 0x1400, 0x0020, 0xe4130804 )    /* tile address decoder (used at runtime) */
  1601.  
  1602.     ROM_REGION( 0x10000, REGION_CPU3 )
  1603.     ROM_LOAD( "r4",          0x04000, 0x8000, 0x0387464f )
  1604.     ROM_LOAD( "rt1-mcu.bin", 0x0f000, 0x1000, 0x6ef08fb3 )
  1605.  
  1606.     ROM_REGION( 0x40000, REGION_SOUND1 ) /* PCM samples for Hitachi CPU */
  1607.     ROM_LOAD( "rt1-21.f3",  0x00000, 0x10000, 0x454968f3 )
  1608.     ROM_LOAD( "rt1-22.h3",  0x10000, 0x10000, 0xfe963e72 )
  1609.     /* k3 empty */
  1610.     /* m3 empty */
  1611. ROM_END
  1612.  
  1613. ROM_START( wndrmomo )
  1614.     ROM_REGION( 0x18000, REGION_CPU1 )
  1615.     ROM_LOAD( "wm1-1.9c", 0x8000, 0x8000, 0x34b50bf0 )
  1616.     /* 9d empty */
  1617.  
  1618.     ROM_REGION( 0x40000, REGION_USER1 ) /* bank switched data for CPU1 */
  1619.     ROM_LOAD( "wm1-16.f1", 0x00000, 0x10000, 0xe565f8f3 )
  1620.     /* h1 empty */
  1621.     /* k1 empty */
  1622.     /* m1 empty */
  1623.  
  1624.     ROM_REGION( 0x18000, REGION_CPU2 )
  1625.     ROM_LOAD( "wm1-2.12c", 0x8000, 0x8000, 0x3181efd0 )
  1626.     /* 12d empty */
  1627.  
  1628.     ROM_REGION( 0x0c000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1629.     ROM_LOAD( "wm1-6.7r", 0x00000, 0x08000, 0x93955fbb )    /* plane 1,2 */
  1630.     ROM_LOAD( "wm1-7.7s", 0x08000, 0x04000, 0x7d662527 )    /* plane 3 */
  1631.  
  1632.     ROM_REGION( 0x0c000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1633.     ROM_LOAD( "wm1-4.4r", 0x00000, 0x08000, 0xbbe67836 )    /* plane 1,2 */
  1634.     ROM_LOAD( "wm1-5.4s", 0x08000, 0x04000, 0xa81b481f )    /* plane 3 */
  1635.  
  1636.     ROM_REGION( 0x80000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  1637.     ROM_LOAD( "wm1-8.12h",  0x00000, 0x10000, 0x14f52e72 )
  1638.     ROM_LOAD( "wm1-9.12k",  0x10000, 0x10000, 0x16f8cdae )
  1639.     ROM_LOAD( "wm1-10.12l", 0x20000, 0x10000, 0xbfbc1896 )
  1640.     ROM_LOAD( "wm1-11.12m", 0x30000, 0x10000, 0xd775ddb2 )
  1641.     ROM_LOAD( "wm1-12.12p", 0x40000, 0x10000, 0xde64c12f )
  1642.     ROM_LOAD( "wm1-13.12r", 0x50000, 0x10000, 0xcfe589ad )
  1643.     ROM_LOAD( "wm1-14.12t", 0x60000, 0x10000, 0x2ae21a53 )
  1644.     ROM_LOAD( "wm1-15.12u", 0x70000, 0x10000, 0xb5c98be0 )
  1645.  
  1646.     ROM_REGION( 0x1420, REGION_PROMS )
  1647.     ROM_LOAD( "wm1-1.3r", 0x0000, 0x0200, 0x1af8ade8 )    /* red & green components */
  1648.     ROM_LOAD( "wm1-2.3s", 0x0200, 0x0200, 0x8694e213 )    /* blue component */
  1649.     ROM_LOAD( "wm1-3.4v", 0x0400, 0x0800, 0x2ffaf9a4 )    /* tiles colortable */
  1650.     ROM_LOAD( "wm1-4.5v", 0x0c00, 0x0800, 0xf4e83e0b )    /* sprites colortable */
  1651.     ROM_LOAD( "wm1-5.6u", 0x1400, 0x0020, 0xe4130804 )    /* tile address decoder (used at runtime) */
  1652.  
  1653.     ROM_REGION( 0x10000, REGION_CPU3 )
  1654.     ROM_LOAD( "wm1-3.6b",    0x04000, 0x8000, 0x55f01df7 )
  1655.     ROM_LOAD( "rt1-mcu.bin", 0x0f000, 0x1000, 0x6ef08fb3 )
  1656.  
  1657.     ROM_REGION( 0x40000, REGION_SOUND1 ) /* PCM samples for Hitachi CPU */
  1658.     ROM_LOAD( "wm1-17.f3", 0x00000, 0x10000, 0xbea3c318 )
  1659.     ROM_LOAD( "wm1-18.h3", 0x10000, 0x10000, 0x6d73bcc5 )
  1660.     ROM_LOAD( "wm1-19.k3", 0x20000, 0x10000, 0xd288e912 )
  1661.     ROM_LOAD( "wm1-20.m3", 0x30000, 0x10000, 0x076a72cb )
  1662. ROM_END
  1663.  
  1664.  
  1665.  
  1666. static void init_namco86(void)
  1667. {
  1668.     int size;
  1669.     unsigned char *gfx;
  1670.     unsigned char *buffer;
  1671.  
  1672.     /* shuffle tile ROMs so regular gfx unpack routines can be used */
  1673.     gfx = memory_region(REGION_GFX1);
  1674.     size = memory_region_length(REGION_GFX1) * 2 / 3;
  1675.     buffer = malloc( size );
  1676.  
  1677.     if ( buffer )
  1678.     {
  1679.         unsigned char *dest1 = gfx;
  1680.         unsigned char *dest2 = gfx + ( size / 2 );
  1681.         unsigned char *mono = gfx + size;
  1682.         int i;
  1683.  
  1684.         memcpy( buffer, gfx, size );
  1685.  
  1686.         for ( i = 0; i < size; i += 2 )
  1687.         {
  1688.             unsigned char data1 = buffer[i];
  1689.             unsigned char data2 = buffer[i+1];
  1690.             *dest1++ = ( data1 << 4 ) | ( data2 & 0xf );
  1691.             *dest2++ = ( data1 & 0xf0 ) | ( data2 >> 4 );
  1692.  
  1693.             *mono ^= 0xff; mono++;
  1694.         }
  1695.  
  1696.         free( buffer );
  1697.     }
  1698.  
  1699.     gfx = memory_region(REGION_GFX2);
  1700.     size = memory_region_length(REGION_GFX2) * 2 / 3;
  1701.     buffer = malloc( size );
  1702.  
  1703.     if ( buffer )
  1704.     {
  1705.         unsigned char *dest1 = gfx;
  1706.         unsigned char *dest2 = gfx + ( size / 2 );
  1707.         unsigned char *mono = gfx + size;
  1708.         int i;
  1709.  
  1710.         memcpy( buffer, gfx, size );
  1711.  
  1712.         for ( i = 0; i < size; i += 2 )
  1713.         {
  1714.             unsigned char data1 = buffer[i];
  1715.             unsigned char data2 = buffer[i+1];
  1716.             *dest1++ = ( data1 << 4 ) | ( data2 & 0xf );
  1717.             *dest2++ = ( data1 & 0xf0 ) | ( data2 >> 4 );
  1718.  
  1719.             *mono ^= 0xff; mono++;
  1720.         }
  1721.  
  1722.         free( buffer );
  1723.     }
  1724. }
  1725.  
  1726.  
  1727.  
  1728. WRITE_HANDLER( roishtar_semaphore_w )
  1729. {
  1730.     rthunder_videoram1_w(0x7e24-0x6000+offset,data);
  1731.  
  1732.     if (data == 0x02)
  1733.         cpu_spinuntil_int();
  1734. }
  1735.  
  1736. static void init_roishtar(void)
  1737. {
  1738.     /* install hook to avoid hang at game over */
  1739.     install_mem_write_handler(1, 0x7e24, 0x7e24, roishtar_semaphore_w);
  1740.  
  1741.     init_namco86();
  1742. }
  1743.  
  1744.  
  1745.  
  1746. GAME( 1986, hopmappy, 0,        hopmappy, hopmappy, namco86,  ROT0,   "Namco", "Hopping Mappy" )
  1747. GAME( 1986, skykiddx, 0,        skykiddx, skykiddx, namco86,  ROT180, "Namco", "Sky Kid Deluxe (set 1)" )
  1748. GAME( 1986, skykiddo, skykiddx, skykiddx, skykiddx, namco86,  ROT180, "Namco", "Sky Kid Deluxe (set 2)" )
  1749. GAME( 1986, roishtar, 0,        roishtar, roishtar, roishtar, ROT0,   "Namco", "The Return of Ishtar" )
  1750. GAME( 1986, genpeitd, 0,        genpeitd, genpeitd, namco86,  ROT0,   "Namco", "Genpei ToumaDen" )
  1751. GAME( 1986, rthunder, 0,        rthunder, rthunder, namco86,  ROT0,   "Namco", "Rolling Thunder (new version)" )
  1752. GAME( 1986, rthundro, rthunder, rthunder, rthundro, namco86,  ROT0,   "Namco", "Rolling Thunder (old version)" )
  1753. GAME( 1987, wndrmomo, 0,        wndrmomo, wndrmomo, namco86,  ROT0,   "Namco", "Wonder Momo" )
  1754.